home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-06-19 | 5.0 KB | 177 lines |
- /*
- * TableCell.java 1.0 12 Jan 1997
- *
- * Copyright (c) 1996 Krumel & Associates, Inc. All Rights Reserved.
- *
- * This software is provided as is. Krumel & Associates shall not be liable
- * for any damages suffered by licensee as a result of using, modifying or
- * distributing this software or its derivatives.
- */
-
- package symantec.itools.db.awt;
-
- import java.awt.*;
-
- /**
- * The TableCell interface serves as the basis for writing cells for the Grid.
- */
- public interface TableCell {
-
- /**
- * Style that indicates that a cell is part of the Grid proper.
- */
- public final static int CELL = 0;
- /**
- * Style value indicates the cell is part of the column headings
- */
- public final static int COL_HEADING = 1;
- /**
- * Style value indicates the cell is part of the row headings
- */
- public final static int ROW_HEADING = 2;
- /**
- * Style value indicates the cell is the corner cell
- */
- public final static int CORNER_CELL = 3;
-
- /**
- * Called when a cell is added to the table through an API call after it
- * has already been created.
- * @param v The grid that contains the cell
- * @param ds The grid's datasource that contains the cells data
- */
- public void setGrid(Grid v, DataSource ds);
-
- /**
- * Sets the coordinates of the cell.
- */
- public void setCoordinates(Coordinate c);
-
- /**
- * Gets the coordinate instance of the cell.
- */
- public Coordinate getCoordinates();
-
- /**
- * Gets the row number of the cell
- */
- public int row();
-
- /**
- * Sets the row number of the cell
- */
- public void setRow(int r);
-
- /**
- * Gets the column number of the cell
- */
- public int col();
-
- /**
- * Sets the column number of the cell
- */
- public void setCol(int c);
-
- /**
- * Called by the grid when the cell needs to be painted
- * @param g The graphics context to draw the cell
- * @param hints The information required by the cell to render its image
- */
- public void drawCell(Graphics g, CellHints hints);
-
- /**
- * Called by the grid when the user triggers a set events to indicate an
- * action event on a cell
- */
- public boolean actionEvent(Event e);
-
- /**
- * Called by the grid when the user triggers a set events to indicate
- * mouse event on a cell (MOUSE_DOWN, MOUSE_UP, MOUSE_MOVE, ...)
- */
- public boolean mouseEvent(Event e);
-
- /**
- * Called by the grid when the user triggers a set events to indicate
- * key event on a cell (KEY_DOWN, KEY_UP, ...)
- */
- public boolean keyEvent(Event e);
-
- /**
- * Called by the grid when the user triggers a set events to indicate
- * focus change event for a cell (GOT_FOCUS, LOST_FOCUS)
- */
- public boolean focusEvent(Event e);
-
- /**
- * When a cell has the keyboard focus, this method is called by the grid to
- * determine if focus can be changed to another cell.
- * @return true if current value is acceptable, false otherwise
- */
- public boolean canLoseFocus();
-
- /**
- * When a cell has the keyboard focus, this method is called by the grid to
- * determine if focus can be changed to another cell due to an arrow press
- * @return true if current value is acceptable, false otherwise
- */
- public boolean loseFocusOnArrow();
-
- /**
- * When a cell has the keyboard focus, this method is called by the grid to
- * determine if the cell type supports user edits.
- * @return true if can change values, false otherwise
- */
- public boolean isCellTypeEditable();
-
- /**
- * Called by the grid to inform the cell the cursor should be shown if
- * appropriate for the cell type
- */
- public void activateCursor();
-
- /**
- * Called by the grid to inform the cell the cursor should not be drawn
- * if appropriate for the cell type
- */
- public void deactivateCursor();
-
- /**
- * Gets the applicable statistics for a cell, such as type, state, value, ...
- */
- public String stats();
-
- /**
- * Gets the data stored by the DataSource for the cell
- */
- public Data getData() throws DataNotAvailable;
-
- /**
- * Gets a duplicate of the cell
- */
- public TableCell cloneCell();
-
- /**
- * Request the cell be put in a neutral state, ie not selected, no data, ...
- */
- public void reset();
-
- /**
- * Sets the cell as a default cell. Default cells are used by the grid
- * when a cell has be explicitly created and stored in the grid. The allows
- * the grid to run without creating a large number of objects for large data sets.
- */
- public void setDefaultFlag();
-
- /**
- * Sets the cell type, such as CELL and COL_HEADING
- */
- public int type(int t);
-
- /**
- * Gets the cell type, such as CELL and COL_HEADING
- */
- public int type();
- }
-
-